//
//  DYLoginRegisterView.m
//  BaiSi
//
//  Created by mac on 16/10/20.
//  Copyright © 2016年 DeYi. All rights reserved.
//

#import "DYLoginRegisterView.h"

@interface DYLoginRegisterView ()
@property (weak, nonatomic) IBOutlet UIButton *LoginButton;

@end

@implementation DYLoginRegisterView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


//- (IBAction)foregtPasswordButtonClick:(id)sender {
//    
//        UIViewController *vc = [[UIViewController alloc] init];
//        vc.view.backgroundColor = [UIColor redColor];
//    [[self viewController] presentViewController:vc animated:YES completion:nil];
//}
//
//}


//获取当前View的控制器
/*
- (UIViewController*)viewController {
 
    for (UIView* next = [self superview]; next; next = next.superview) {
        
        UIResponder* nextResponder = [next nextResponder];
        
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            
            return (UIViewController*)nextResponder;
            
        }
        
    }
    
    return nil;
    
}
*/

+ (instancetype)loginViewFromXib {
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] firstObject];
}

+ (instancetype)registerViewFromXib {
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
}

- (void)awakeFromNib {
    
    UIImage *bgImage = [_LoginButton backgroundImageForState:UIControlStateNormal];
    bgImage = [bgImage stretchableImageWithLeftCapWidth:bgImage.size.width * 0.5 topCapHeight:bgImage.size.height * 0.5];
    [_LoginButton setBackgroundImage:bgImage forState:UIControlStateNormal];


}

@end
